<%-- 
    Document   : index
    Created on : Sep 8, 2013, 2:29:59 AM
    Author     : Administrator
--%>

<%@page import="Controler.CXuLy"%>
<%@page import="java.util.Date"%>
<%@page import="Model.Pojo.Khachhang"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<head>
    <meta charset="utf-8" />
    <title> <%
        //Cap nhat thong tin khach hang
        if (request.getAttribute("CAP_NHAT_KHACH_HANG") != null)
        {
            out.print("Cập nhật thông tin khách hàng");
        }
        else
        {
            out.print("Thêm khách hàng");
        }
        %> </title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
    <meta content="Mosaddek" name="author" />
    <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" />
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <link href="css/style-responsive.css" rel="stylesheet" />
    <link href="css/style-default.css" rel="stylesheet" id="style_color" />

    <link href="assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" />

    <link rel="stylesheet" type="text/css" href="assets/chosen-bootstrap/chosen/chosen.css" />
    <link rel="stylesheet" type="text/css" href="assets/jquery-tags-input/jquery.tagsinput.css" />
    <link rel="stylesheet" type="text/css" href="assets/clockface/css/clockface.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-timepicker/compiled/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" href="assets/bootstrap-toggle-buttons/static/stylesheets/bootstrap-toggle-buttons.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-daterangepicker/daterangepicker.css" />

</head>
<body class="fixed-top">
    <jsp:include page="User Control/banner.jsp" flush="true"></jsp:include>

        <div id="container" class="row-fluid">
        <jsp:include page="User Control/menu.jsp" flush="true"></jsp:include>
            <div id="main-content">
                <div class="container-fluid">
                <jsp:include page="User Control/title.jsp" flush="true"></jsp:include>
                    <div class="row-fluid">
                        <div class="span12">
                            <!-- BEGIN VALIDATION STATES-->
                            <div class="widget red">
                                <div class="widget-title">
                                    <h4><i class=" icon-key"></i>
                                    <%
                                        //Cap nhat thong tin khach hang
                                        if (request.getAttribute("CAP_NHAT_KHACH_HANG") != null)
                                        {
                                            out.print("Cập nhật thông tin khách hàng");
                                        }
                                        else
                                        {
                                            out.print("Thêm khách hàng");
                                        }
                                    %>
                                </h4>
                                <span class="tools">
                                    <a href="javascript:;" class="icon-chevron-down"></a>
                                    <a href="javascript:;" class="icon-remove"></a>
                                </span>
                            </div>
                            <div class="widget-body form">
                                <!-- BEGIN FORM-->
                                <%

                                    String error = (String) request.getAttribute(
                                            "ERROR");
                                    Object obj = request.getAttribute("QUAN_LY_KHACH_HANG");
                                    if (obj == null)
                                    {
                                        error = "The page you request was not found.";
                                    }
                                    if (error == null && obj != null)
                                    {
                                        Khachhang dtoKH = (Khachhang) request.getAttribute(
                                                "CHI_TIET_KHACH_HANG");
                                %>
                                <jsp:useBean id="chitietkhachhang" class="Model.Pojo.Khachhang">
                                    <%
                                        if (dtoKH != null)
                                        {
                                    %>
                                    <jsp:setProperty name="chitietkhachhang" property="id" value="<%=dtoKH.getId()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="cmnd" value="<%=dtoKH.getCmnd()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="diachi" value="<%=dtoKH.getDiachi()%>" />
                                    <jsp:setProperty name="chitietkhachhang" property="email" value="<%=dtoKH.getEmail()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="ghichu" value="<%=dtoKH.getGhichu()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="gioitinh" value="<%=dtoKH.getGioitinh()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="hoten" value="<%=dtoKH.getHoten()%>" />
                                    <jsp:setProperty name="chitietkhachhang" property="makh" value="<%=dtoKH.getMakh()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="ngaylap" value="<%=dtoKH.getNgaylap()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="ngaysinh" value="<%=dtoKH.getNgaysinh()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="sodienthoai" value="<%=dtoKH.getSodienthoai()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="taikhoannganhang" value="<%=dtoKH.getTaikhoannganhang()%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="tinhtrang" value="<%=dtoKH.getTinhtrang()%>"/>
                                    <%
                                    }
                                    else
                                    {
                                    %>
                                    <jsp:setProperty name="chitietkhachhang" property="id" value="1"/>
                                    <jsp:setProperty name="chitietkhachhang" property="cmnd" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="diachi" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="email" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="ghichu" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="gioitinh"/>
                                    <jsp:setProperty name="chitietkhachhang" property="hoten" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="makh" value="<%=String.valueOf((new Date()).getTime())%>"/>
                                    <jsp:setProperty name="chitietkhachhang" property="ngaysinh" value='<%=CXuLy.ConvertStringToDate("11/11/1991")%>'/>
                                    <jsp:setProperty name="chitietkhachhang" property="sodienthoai" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="taikhoannganhang" value=""/>
                                    <jsp:setProperty name="chitietkhachhang" property="tinhtrang"/>
                                    <%                                                }
                                    %>
                                </jsp:useBean>
                                <form class="cmxform form-horizontal" id="commentForm" method="post" action="them-khach-hang.htm">

                                    <div class="control-group">
                                        <label class="control-label">Mã khách hàng</label>
                                        <div class="controls">
                                            <input class="span6 " name ="txtMaKhachHang" type="text" readonly="" value='<jsp:getProperty name="chitietkhachhang" property="makh" />' placeholder="">
                                            <span class="help-inline"></span>
                                        </div>
                                    </div>
                                    <div class="control-group ">
                                        <label for="cemail" class="control-label">Họ tên (*)</label>
                                        <div class="controls">
                                            <input class="span6 " id="cname" name="txtHoTen" minlength="2" value='<jsp:getProperty name="chitietkhachhang" property="hoten" />' type="text" required />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">Giới tính</label>
                                        <div class="controls">
                                            <div id="text-toggle-button">
                                                <%
                                                    if (chitietkhachhang.getGioitinh() != null)
                                                    {
                                                        out.print(
                                                                " <input type=\"checkbox\" checked=checked name=\"chkGioiTinh\" />");
                                                    }
                                                    else
                                                    {
                                                        out.print(
                                                                " <input type=\"checkbox\" name=\"chkGioiTinh\" />");
                                                    }
                                                %>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="control-group ">
                                        <label for="cemail" class="control-label">Địa chỉ (*)</label>
                                        <div class="controls">
                                            <input class="span6 " id="cname" name="txtDiaChi" value='<jsp:getProperty name="chitietkhachhang" property="diachi" />' minlength="2" type="text" required />
                                        </div>
                                    </div>
                                    <div class="control-group ">
                                        <label for="cemail" class="control-label">Số điện thoại (*)</label>
                                        <div class="controls">
                                            <input class="span6 " id="cname" name="txtSoDienThoai" minlength="2" value='<jsp:getProperty name="chitietkhachhang" property="sodienthoai" />' type="text" required />
                                        </div>
                                    </div>
                                    <div class="control-group ">
                                        <label class="control-label" for="cemail">E-Mail (*)</label>
                                        <div class="controls">
                                            <input id="cemail" class="span6 " type="email" required="" value='<jsp:getProperty name="chitietkhachhang" property="email" />' name="txtEmail">
                                        </div>
                                    </div>
                                    <div class="control-group ">
                                        <label for="cemail" class="control-label">CMND (*)</label>
                                        <div class="controls">
                                            <input class="span6 " id="cname" name="txtCMND" minlength="2" value='<jsp:getProperty name="chitietkhachhang" property="cmnd" />' type="text" required />
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label class="control-label">Ngày sinh (*)</label>
                                        <div class="controls">
                                            <div class="input-append date" id="dpYears" data-date="11/11/1991"
                                                 data-date-format="dd/mm/yyyy" data-date-viewmode="years">
                                                <input class="m-ctrl-medium" size="16" type="text" value="<%=CXuLy.ConvertDateToString(chitietkhachhang.getNgaysinh())%>" name="txtNgaySinh" readonly >
                                                <span class="add-on"><i class="icon-calendar"></i></span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="control-group ">
                                        <label for="cemail" class="control-label">Tài khoản ngân hàng (*)</label>
                                        <div class="controls">
                                            <input class="span6 " id="cname" name="txtTaiKhoanNganHang" value='<jsp:getProperty name="chitietkhachhang" property="taikhoannganhang" />' minlength="2" type="text" required />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">Ghi chú</label>
                                        <div class="controls">
                                            <textarea class="span6 " name="txtGhiChu" value='<jsp:getProperty name="chitietkhachhang" property="ghichu" />' rows="3"></textarea>
                                        </div>
                                    </div>
                                    <div class="form-actions">
                                        <button class="btn btn-success" type="submit">Lưu</button>
                                        <button class="btn" type="button">Hủy</button>
                                    </div>
                                </form>
                                <!-- END FORM-->
                                <%                        }
                                else
                                {
                                %>
                                <h1 style="color: red"><%=error%></h1>
                                <%                                            }
                                %>
                            </div>
                        </div>
                        <!-- END VALIDATION STATES-->
                    </div>
                </div>
            </div>
        </div>
        <!-------------------------------- ket thuc nội dung--------------------------------------->

    </div>

    <!--------------------------------footer--------------------------------------->
    <jsp:include page="User Control/footer.jsp" flush="true"></jsp:include>

    <!--------------------------------end footer--------------------------------------->

    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="js/jquery.nicescroll.js" type="text/javascript"></script>
    <script type="text/javascript" src="assets/ckeditor/ckeditor.js"></script>
    <script src="assets/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="assets/bootstrap/js/bootstrap-fileupload.js"></script>
    <script src="js/jquery.blockui.js"></script>
    <!-- ie8 fixes -->
    <!--[if lt IE 9]>
    <script src="js/excanvas.js"></script>
    <script src="js/respond.js"></script>
    <![endif]-->
    <script type="text/javascript" src="assets/bootstrap-toggle-buttons/static/js/jquery.toggle.buttons.js"></script>
    <script type="text/javascript" src="assets/chosen-bootstrap/chosen/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="assets/uniform/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="assets/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script>
    <script type="text/javascript" src="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
    <script type="text/javascript" src="assets/clockface/js/clockface.js"></script>
    <script type="text/javascript" src="assets/jquery-tags-input/jquery.tagsinput.min.js"></script>
    <script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-daterangepicker/date.js"></script>
    <script type="text/javascript" src="assets/bootstrap-daterangepicker/daterangepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>
    <script src="assets/fancybox/source/jquery.fancybox.pack.js"></script>


    <!--common script for all pages-->
    <script src="js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="js/form-component.js"></script>
</body>
</html>